import printJS from 'print-js'

export const printHtml = (printable?: string) => {
	const style = `
  @page { size: auto; } 
  .paging{page-break-after: always;}
  `

	const printConfig: any = {
		printable: printable||'print', // 打印区域id名称
		type: 'html',
		style: style, // 亦可使用引入的外部css;
		targetStyle: '*',
		scanStyles: true,
		maxWidth: '1000',
		targetStyles: ['*'],
		ignoreElements: ['no-print'],
		css: ['//unpkg.com/element-plus/dist/index.css'],
		onPrintDialogClose: () => {},
		onLoadingEnd: () => {},
	}
	printJS(printConfig)
}
